<include file="Public/head"/>

<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>
            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                    <div class="cf">
                        <form class="form-inline" action="" method="post">
                            <a class="btn btn-info" href="{:U('add')}" value="">新增</a>
                            <label class="inline">驾照类型</label>
                            <select name="type" class="form-control">
                                <option value="0">--驾照--</option>
                                {$license}
                            </select>
                            <label class="inline">班型名字</label>
                            <input type="text" name="keyword" value="{:I('keyword')}" class="form-control">
                            <button type="submit" class="btn btn-purple btn-sm">
                                <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                                搜索
                            </button>
                        </form>
                    </div>
                    <!--<a class="btn btn-info" href="{:U('add')}" value="">新增</a>-->
                    <div class="space-4"></div>
                    <form id="form" method="post" action="{:U('del')}">
                        <table class="table table-striped table-bordered">
                            <thead>
                            <tr>
                                <th class="center"><input class="check-all" type="checkbox" value=""></th>
                                <th>驾校</th>
                                <th>驾照类型</th>
                                <th>班型名字</th>
                                <th class="">价格</th>
                                <th class="col-xs-7">描述</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>

                            <foreach name="list" item="val">
                                <tr>
                                    <td class="center">
                                        <input class="comments"
                                               type="checkbox"
                                               name="id[]"
                                               value="{$val['id']}">
                                    </td>
                                    <td>{$val['school_name']}</td>
                                    <td>{$val['type']}</td>
                                    <td>{$val['name']}</td>
                                    <td>￥&nbsp;{$val['price']}</td>
                                    <td>{$val['notes']}</td>
                                    <td><a href="{:U('edit',array('id'=>$val['id']))}"><i
                                            class="ace-icon fa fa-pencil bigger-100"></i>编辑</a>&nbsp;&nbsp;
                                        <a href="javascript:;" val="{:U('del',array('id'=>$val['id']))}" class="del"><i
                                                class="ace-icon fa fa-trash-o bigger-100 red"></i>删除</a></td>
                                </tr>
                            </foreach>
                            </tbody>
                        </table>
                    </form>
                    <div class="cf">
                        <input id="submit" class="btn btn-info" type="button" value="删除">
                    </div>
                    {$page}
                    <!-- PAGE CONTENT ENDS -->
                </div><!-- /.col -->
            </div><!-- /.row -->
        </div><!-- /.page-content -->
    </div>
</div><!-- /.main-content -->
<include file="Public/footer"/>

</div><!-- /.main-container -->

<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script type="text/javascript">
    $(function () {
        $(".check-all").click(function () {
            $(".comments").prop("checked", this.checked);
        });
        $(".comments").click(function () {
            var option = $(".ids");
            option.each(function (i) {
                if (!this.checked) {
                    $(".check-all").prop("checked", false);
                    return false;
                } else {
                    $(".check-all").prop("checked", true);
                }
            });
        });
        $("#submit").click(function () {
            bootbox.confirm({
                title: "系统提示",
                message: "是否要删除此类驾照？？",
                callback: function (result) {
                    if (result) {
                        $("#form").submit();
                    }
                },
                buttons: {
                    "cancel": {"label": "取消"},
                    "confirm": {
                        "label": "确定",
                        "className": "btn-danger"
                    }
                }
            });
        });
        $(".del").click(function () {
            var url = $(this).attr('val');
            bootbox.confirm({
                title: "系统提示",
                message: "是否要删除此类驾照？",
                callback: function (result) {
                    if (result) {
                        window.location.href = url;
                    }
                },
                buttons: {
                    "cancel": {"label": "取消"},
                    "confirm": {
                        "label": "确定",
                        "className": "btn-danger"
                    }
                }
            });
        });
    })
</script>
</body>
</html>
